
var webpack = require('webpack')
var values = require('postcss-modules-values');

module.exports = {
    context: __dirname + '/src',
    entry: {
        app: ['./app.js', './home.js', './vendor.js']
    },
    output: {
        path: __dirname + "/dist",
        filename: '[name].bundle.js'
    },
    devServer: {
        // contentBase: __dirname + '/src'
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin({
            name: 'commons',
            filename: 'commons.js',
            minChunks: 2
        }),

        new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           postcss: [ values ]
         }
       })
    ],
    module: {
        rules: [
            {
                test: /^((?!node_modules).)*\.js$/,
                loader: [{
                    loader: 'babel-loader',
                    options: { presets: ["es2015"] }
                }]
            },
            {
                test: /\.css$/,
                use: [
                    'style-loader',
                    // 'css-loader'
                    { loader: 'css-loader', options: { modules: true } },
                    'postcss-loader'
                ]
            }
        ]
    }
}
